
<!-- 右 -->
<div class="content">
    <div class="header">
        <h1 class="page-title">管理员新增</h1>
    </div>

    <div class="well">
        <!-- add form -->
        <form action="{:url('/admin/manager/insert')}" method="post" id="tab">
            {:token()}
            <label>用户名：</label>
            <input type="text" name="username" id="user" value="" class="input-xlarge">
            <label>昵称</label>
            <input type="text" name="nickname" id="nick" value="" class="input-xlarge">
            <label>密码：</label>
            <input type="password" name="password" id="pwd" value="" class="input-xlarge">
            <label>确认密码：</label>
            <input type="password" name="password_confirm" id="repwd" value="" class="input-xlarge">
            <label>邮箱：</label>
            <input type="email" name="email" id="email" value="" class="input-xlarge">

            <p><span>登录状态：<input type="checkbox" id="sta" name="status" value="1" checked="checked" class="input-xlarge"></span></p>
            <p>
                <span>权限分类：</span>
                {foreach $rule as $v}
                    <input type="radio" name="role_id" id="role" value="{$v.id}" class="input-xlarge">{$v.role_name}
                {/foreach}
            </p>

            <button class="btn btn-primary" type="button">保存</button>
        </form>
    </div>
</div>
<script>
        $(".btn-primary").click(function(){

            var flag = true;

            if($("#user").val() == "" || $("#nick").val() == "" || $("#pwd").val() == "" || $("#repwd").val() == "" || $("#email").val() == ""){
                alert("亲！不允许为空哦");
                flag = false;
            }

            if(flag){
                $("#tab").submit();
            }
        })
</script>